<template>
  <van-nav-bar
    id="navbarMain"
    class="w-percent100"
    :title="navinfo.title"
    :left-text="navinfo.leftText"
    :right-text="navinfo.rightText"
    :left-arrow="navinfo.leftText!=''"
    @click-left="onClickLeft"
    @click-right="onClickRight"
  >
    <!--<van-icon :name="navinfo.rightIcon" slot="right" />-->
  </van-nav-bar>
</template>
<script>

export default {
  data() {
    return {
    }
  },
  props:['navinfo'],
  methods:{
    onClickLeft() {
      this.$router.go(-1);
    },
    onClickRight() {
      if(this.navinfo.rightLink=="logout"){
        this.$store.commit("saveLoadingMap",{"target":this.proAPI.URLS.logout,lock:1,text:"正在退出"});
        this.proAPI.postJson(this.proAPI.URLS.logout).then(()=>{
          this.proUtil.msgSuccess("已退出登陆");
          setTimeout(()=>{
            this.$store.commit("clearToken");
            this.$router.replace("/login");
          },500)
        }).catch(()=>{
        })
      }
    }
  },
  beforeCreate: function() {
  },
  created: function() {
  },
  beforeMount: function() {
  },
  mounted: function() {
  },
  beforeUpdate: function() {
  },
  updated: function() {
  },
  activated: function() {
  },
  deactivated: function() {
  },
  beforeDestroy: function() {
  },
  destroyed: function() {
  },
  errorCaptured: function(err, vm, info) {
  }
}
</script>
<style scoped>
  .van-nav-bar__title{
    color:#ffffff;
  }
  #navbarMain>>>.van-nav-bar__text:active{
    background-color: transparent;
    color:#00aeef;
  }
  #navbarMain>>>.van-nav-bar__text{
    background-color: transparent;
    color:#ffffff;
  }
  #navbarMain>>>.van-icon{
    color:#ffffff;
  }
</style>
